package cn.edu.lzu.unitweb.filter;

import org.apache.shiro.session.SessionException;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.web.filter.authc.LogoutFilter;
import org.apache.shiro.web.util.WebUtils;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import java.util.Locale;

/**
 * @PackageName: cn.edu.lzu.unitweb.filter
 * @ClassName: ExaminerLogoutFilter
 * @Description: TODO
 * @Author: 张琦[QQ:3098086691]
 * @Date: 2019/11/30 13:15
 * @Version: 1.0
 */
/*@Component*/
public class ExaminerLogoutFilter extends LogoutFilter {
    @Override
    protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception {
        Subject subject = this.getSubject(request, response);
        String redirectUrl = this.getRedirectUrl(request, response, subject);
        try {
            subject.logout();
        } catch (SessionException var6) {
            System.out.println("退出登录异常"+var6);
        }
        this.issueRedirect(request, response, redirectUrl);
        return false;

    }

}
